$def with(book, size="M")

$ title = book.title
$ author_names = ", ".join(a.get("name", "Name missing") for a in book.get_authors()) or book.get('by_statement','')

$ cover_url = book.get_cover_url(size)

$ cover_lg = book.get_cover_url("L")

$if size == "M":
    <div class="coverMagic">
        <div class="SRPCover bookCover" style="display: $cond(cover_url, 'block', 'none');">
            <a href="$cover_lg" aria-controls="seeImage"
                class="coverLook dialog--open" title="View a larger book cover"><img src="$cover_url" class="cover" alt="Cover of: $title $_('by') $author_names"/></a>
        </div>
        <div class="SRPCoverBlank" style="display: $cond(not cover_url, 'block', 'none');">
            <div class="innerBorder">
                <div class="BookTitle">$:macros.TruncateString(title, 70)
                    <div class="Author">$:macros.TruncateString(author_names, 30)</div>
                </div>
            </div>
        </div>
    </div>
$else:
    <img src="$(cover_url or '/images/icons/avatar_book-sm.png')" height="58" alt="We need a book cover for: $title"/>

<div class="hidden">
    <div class="coverFloat" id="seeImage">
        <div class="coverFloatHead">
            <a class="dialog--close">&times;<span class="shift">$_("Close")</span></a>
        </div>
        <a class="dialog--close"><img src="$cover_lg" class="cover" alt="$title $_('by') $author_names"/></a>
    </div>
</div>
